<!--
 * @Author: your name
 * @Date: 2021-10-08 19:22:37
 * @LastEditTime: 2021-10-08 21:19:03
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue3.0\vue3_vite\src\pages\connection\test2\child.vue
-->
<template>
  <h1>child</h1>
  <p>{{ name }} -- {{ age }} -- {{ counter_pro }}</p>
  <p>传递函数：{{ fooComputed }}</p>
</template>

<script>
export default {
  inject: ['name', 'age', 'counter_pro', 'newCounter'],
  computed:{
    fooComputed () {
      return this.newCounter()  // 因为传递过来是个引用类型的函数
    }
  }
}
</script>

<style>

</style>